package com.agv.core.dao.catalogosImpl;

import org.apache.log4j.Logger;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

import com.agv.core.dao.catalogos.MonedaDAO;
import com.agv.core.dao.exception.QueryDAOException;
import com.agv.core.dao.mapper.ClienteMapper;
import com.agv.core.dao.mapper.MonedaMapper;
import com.agv.dto.ClienteDTO;
import com.agv.dto.MonedaDTO;

public class MonedaDAOImpl extends JdbcDaoSupport implements MonedaDAO{

	/** Logger para DEBUG, INFO */
	private static Logger log = Logger.getLogger(MonedaDAOImpl.class);
	
	public MonedaDTO getMoneda( String codCliente) throws QueryDAOException {
		try {
			return (MonedaDTO) getJdbcTemplate().queryForObject(
					CONSULTA_MONEDA, new Object[] { codCliente },
					new MonedaMapper());
		
		} catch (EmptyResultDataAccessException erdae) {
			return null;
		
		} catch (DataAccessException dae) {
			throw new QueryDAOException("app.error.consulta.usuario", dae);
		}
	}
	final String CONSULTA_MONEDA =
	"SELECT cd_divisa, id_divisa, nb, pais, activo, id_usuario_act_ant, fh_act_ant,"+ 
           "campo_act, id_usuario_ult_act, fh_ult_act, id_usuario_crc, fh_creacion,"+ 
           "decimales FROM ctb.t001_ctb_cfg_moneda where cd_divisa = ?";	

}

